#include "AttList.h"
#include "Attribut.h"

#include <string>
#include <list>


using namespace std;

/**
* Constructeur
*/
AttList::AttList()
{
	name = "NO NAMED";
}

AttList::AttList( const string& pname ) : name( pname )
{
}

/**
* Destructeur
*/
AttList::~AttList()
{
listBinded.clear();
}

/**
 * Modifie le nom
 * @param le nouveau nom
 */
void AttList::setName(const string& pname)
{
	name = pname;
}

/**
* Retourne le nom
* @return Le nom
*/
const string& AttList::getName() const
{
	return name;
}

/**
* Retourne la liste des attributs
*/
const list<Attribut*>& AttList::getList() const
{
	return listBinded;
}

void AttList::printMe()
{
	cout<< "<!ATTLIST " << "\t" <<name;

	list<Attribut*>::iterator p = listBinded.begin();
	while(p != listBinded.end())
	{
		cout<<"\n \t \t";
		(*p)->printMe();
		p++;
	}
	cout<< " >"<<endl;;
}

void AttList::addAttribut( Attribut* attrib )
{
	listBinded.push_back( attrib );
}
